﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SE;
using System.Data;
using System.Data.SqlClient; 
namespace WebApplication1 {
    public partial class _Default : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
          //  MyObject.CreateNew(typeof(Ogrenci),typeof(Okul));
            loadData();
        }
        void loadData() {
            //GridView1.DataSource = MyObject.GetObjects(typeof(Ogrenci));
            Ogrenci or = new Ogrenci();
            or.Name = "Has";
            GridView1.DataSource = MyObject.IsLikeObjects(or);
            GridView1.DataBind();
        }
        protected void Button_Save_Click(object sender, EventArgs e) {
            Ogrenci or = new Ogrenci();
            or.Name = TextBox_Name.Text;
            or.Surname = TextBox_Surname.Text;
            or.Age = Convert.ToInt32(TextBox_Age.Text);
            if (MyObject.IsSaved(or)) {
                Response.Write("Bu Kayıt Daha Önce Oluşturulmuş");
            } else {
                MyObject.Save(or); 
            }
        } 

    }
}